package com.override_重写;

public class override01 {
    public static void main(String[] args) {
        dog dog = new dog();
        dog.eat();
    }
}

class animal{
    public void eat(){
        System.out.println("动物吃食物");
    }
}
class dog extends animal{
    public void eat(){ // 子类重写父类的eat()方法, 子类方法与父类方法名相同，参数列表相同，返回值类型相同
        System.out.println("狗吃骨头");
    }
}